<?php
include_once("../module/checkA.php");
include_once("../../config.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'finance'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
if(!$_REQUEST ['applydate'])
{
    $_REQUEST ['applydate']=date("Y-m");
}
$applydate  = addslashes($_REQUEST ['applydate']);
?>



<?
//获取部门的 nid名字对应表
$department_full_list=select_lines_all_items($table_Prefix."department","","","");
$department_list=transform_2darray_in_1darray_with_new_key($department_full_list,"nid","name");

//获取员工的 nid名字对应表
$employee_full_list=select_lines_all_items($table_Prefix."employee","","","");
$employee_list=transform_2darray_in_1darray_with_new_key($employee_full_list,"nid","name");



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include_once(ROOT_PATH_.'/controlbase/module/head.php'); ?>

</head>

<body>

<div id="topbar">
    <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?>
        </div>




        <div id="content">
            <fieldset class="layui-elem-field layui-field-title">
                <legend><b>财务明细</b> </legend>
            </fieldset>


            <input name="print" type="button" id="bt" value="点击打印" class="layui-btn" onclick="print_btn('div_print')"/>



            <!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
            <div class="list-box">

                <div class="statistic">


                    <div class="term-select-function">
                        <label class="layui-form-label">筛选：</label>
                        <div class="layui-input-block">

                            <?
                            $oldest_men=select_one_line_all_items($table_Prefix."finance","nid > 0 order by applydate asc");


                            date_default_timezone_set('Asia/Shanghai');
                            $first_day_of_month = date('Y-m',time()) . '-01 00:00:01';
                            $t = strtotime($first_day_of_month);

                            $oldest_month=substr($oldest_men['applydate'],0,7);

                            $endmark=10000;

                            for ($i = 0; $i < $endmark; $i++) {



                                if(date("Y-m",strtotime("-$i month",$t))==$oldest_month)
                                {
                                    $endmark=0;
                                    $showdate[$i]=date("Y-m",strtotime("-$i month",$t));
                                }
                                else
                                {

                                    $showdate[$i]=date("Y-m",strtotime("-$i month",$t));
                                }


                            }


                            ?>


                            <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
                                <option value=""> </option>
                                <?php
                                for ($i = 0; $i < count($showdate); $i++) {
                                    ?>
                                    <option value="list.php?applydate=<? echo $showdate[$i] ?>&nav-itemed=<? echo $system_part ?>"> <? echo $showdate[$i];?> </option>
                                    <?;}?>
                            </select>

                        </div>
                    </div>


                </div>


         <br class="clearfloat"/>





                <div id="div_print">
                <div class="detail-staitics-info" >



                    <?

$sumcost=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and applydate like '%".$applydate."%' ");
$sumcost_weixiu=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%' and classify = '维修费' ");
$sumcost_lingjiangoumai=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '零件购买' ");
$sumcost_goumaibaoxian=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '购买保险' ");
$sumcost_yewufei=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%' and classify = '业务费' ");
$sumcost_shebeigouzhifei=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '设备购置费' ");
$sumcost_yewuzhaodaifei=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '业务招待费' ");
$sumcost_bangongyongpin=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '办公用品' ");
$sumcost_qita=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '其他' ");

                    $sumcost_huoshizhichu=sum_total($table_Prefix."finance","cost", "(rid is null or rid = '0') and  applydate like '%".$applydate."%'  and classify = '伙食支出' ");





                    ?>
                    <ul>

                        <li><label>本月合计支出:</label>
                            <?echo $sumcost;?>
                            <b> 元</b>
                        </li>




                        <br class="clearfloat"/>

                        <li><label>维修费:</label>
                            <?echo $sumcost_weixiu;?>
                            <b> 元</b>
                        </li>

                        <li><label>零件购买:</label>
                            <?echo $sumcost_lingjiangoumai;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>购买保险:</label>
                            <?echo $sumcost_goumaibaoxian;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>业务费:</label>
                            <?echo $sumcost_yewufei;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>设备购置费:</label>
                            <?echo $sumcost_shebeigouzhifei;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>业务招待费:</label>
                            <?echo $sumcost_yewuzhaodaifei;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>办公用品:</label>
                            <?echo $sumcost_bangongyongpin;?>
                            <b> 元</b>
                        </li>

                        <li>
                            <label>伙食支出:</label>
                            <?echo $sumcost_huoshizhichu;?>
                            <b> 元</b>
                        </li>


                        <li>
                            <label>其他:</label>
                            <?echo $sumcost_qita;?>
                            <b> 元</b>
                        </li>




                    </ul>

                    <hr/>





                <!--list-box end-->
            </div>

            <!--content端點01-->
        </div>
        <!--maincontent端點01-->
        <br class="clearfloat"/>
    </div>
    <!--container端點01-->
</div>











<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?> </body>
</html>
